<?php 
$doc = (isset($_POST['doc'])?$_POST['doc']:'0');
$td = (isset($_POST['td'])?$_POST['td']:'0');
?>
<div align="right" style="margin-top:10px;"><input class="enabled" type='button' value="Act.Documentos" onclick="updFlujoDocs(this,'<?php echo $td;?>','<?php echo $doc;?>');" /></div>
<?php	
	if ( $doc > 0){
	$sql = "call sp_getNextDocumentos('".$td."','".$doc."');";
	$res = $mysqli->query($sql);
	$cnt = 0;
	if($res){
	$cnt = $mysqli->affected_rows;
		if ($cnt > 0){
	?>
        <table width="100%" border="1" rules="all" cellpadding="0" cellspacing="0" id="tbl_doc_gen">
        <thead>
        <tr>
        <th>Documento</th><th>Clase</th><th>Creador por</th><th>Creado el</th><th>Monto</th>
        <th>Moneda</th>
        </tr>
        </thead>
        <tbody>    
		<?php 
		}
		
        while($row = $res->fetch_assoc()){
        ?>
        <tr>
        <td><a href="#" class="a" cladoc="<?php echo $row['TypeDoc'];?>"><?php echo $row['DocNextID']; ?></a></td>
        <td><?php echo $row['ClaDocNom']; ?></td>
        <td><?php echo $row['UserID']; ?></td>        
        <td><?php echo $row['FecCre']; ?></td>
        <td class="qt"><?php echo $row['Monto']; ?></td>
        <td><?php echo $row['MoneyID'];?></td>
        </tr>
        <?php 
        } 
			if ($cnt > 0){
			?>		
		  </tbody>
			</table>
	 <?php 
			}
	$res->close();
	$mysqli->check_result();
	}
}
?>
<script type="text/javascript">
$("#tbl_doc_gen .a").each(function(){
	var clase = $(this).attr('cladoc');
	if (clase == "F" || clase == "A" ){
		this.onclick = function(){
			vf(this,true);
		}	
	}
	else if (clase == 'G'){
		this.onclick = function(){
			vg(this,true);
		}
	}
});
</script>